#include "led.h"
ledc_timer_config_t ledc_timer_ls = {
    .duty_resolution = LEDC_TIMER_13_BIT, // 设置分辨率,最大为2^13-1
    .freq_hz = 5000,                      // PWM信号频率
    .speed_mode = LEDC_LOW_SPEED_MODE,           // 定时器模式
    .timer_num = LEDC_LOW_SPEED_MODE,            // 
};
ledc_channel_config_t ledc_channel = { 
	.channel =	LEDC_CHANNEL_7,	// LED控制器通道号, 
	.duty = 8191, 
	.gpio_num = 2,				// LED控制器通道对应GPIO, 
	.speed_mode = LEDC_LOW_SPEED_MODE, // 模式, 
	.timer_sel = LEDC_TIMER_0,   		// 使用哪个定时器0-3
};

void ledInit()
{
    esp_rom_gpio_pad_select_gpio(LED_pin);
    gpio_set_direction(LED_pin, GPIO_MODE_OUTPUT);

    ledc_timer_config(&ledc_timer_ls);
    // 配置LED控制器
    ledc_channel_config(&ledc_channel);

}

